﻿using GDGeek;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace MrPP.UX
{
    public class RotateUIEffect : MonoBehaviour//UIEffect
    {

        [SerializeField]
        private float _hideTime = 0.5f;
        [SerializeField]
        private Easing.Method _method = Easing.Method.Linear;

        [SerializeField]
        private float _showTime = 0.5f;



        [SerializeField]
        private Vector3 _begin;
        [SerializeField]
        private Vector3 _end;

        public  Task hide()
        {
            Task task = new TweenTask(delegate {
                Tween tween = TweenRotation.Begin(this.gameObject, _hideTime, _end, _begin);
                tween.method = this._method;
                return tween;
            });

           
            return task;
        }

        public void Start()
        {
            this.transform.localEulerAngles = this._begin;
            //this.gameObject.SetActive(false);

            

        }

        public Task show()
        {
            Task  task = new TweenTask(delegate {
                Tween tween = TweenRotation.Begin(this.gameObject, _showTime, _begin, _end);
                tween.method = this._method;
                return tween;
            });
            
            return task;
        }


    }
}